home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-10-18 | 708 b | 31 lines |
- import vrml.*;
- import vrml.field.*;
- import vrml.node.*;
-
- public class MoveIt extends Script {
-
- private SFBool on; // status of on-off
- float red[] = { 1, 0, 0 }; // RGB(Red)
- float blue[] = { 0, 0, 1 }; // RGB(Blue)
- private SFNode theNode ;
- private SFVec3f position;
-
- public void initialize() {
-
- theNode = (SFNode) getField("node");
-
- }
-
- public void processEvent(Event e) {
- ConstSFBool v = (ConstSFBool)e.getValue();
- Node node;
-
- if(v.getValue()){
- node = (Node)(theNode.getValue());
-
- position = (SFVec3f)(node.getExposedField("translation"));
- position.setValue((position.getX() + 5), 0, 0);
- }
- }
- }
-